package com.yang.dreammanage.controller;

import com.yang.dreammanage.pojo.Result;
import com.yang.dreammanage.pojo.User;
import com.yang.dreammanage.service.impl.AuthenticationServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 统一认证
 */
@Controller
public class AuthenticationController {

    @Autowired
    AuthenticationServiceImpl authenticationService;

    @PostMapping
    public Result<String> register(@RequestBody User user){
        String result = authenticationService.register(user);
        return new Result<>(200,"注册成功！",result);
    }

    @PostMapping
    public Result<String> login(@RequestBody User user){
        String result = authenticationService.login(user);
        return new Result<>(200,"登录成功！",result);
    }

}
